/*
 * @Author: 黄宏智(HarryWong)
 * @Date: 2023-07-11 17:12:28
 * @LastEditors: 黄宏智(HarryWong)
 * @LastEditTime: 2023-09-11 12:06:21
 * @FilePath: /busienginewebsite/src/router/index.ts
 * @Description:
 */
import { createRouter, createWebHistory } from 'vue-router'

const baseRouter = [
  {
    name: 'home',
    path: '/',
    meta: { title: '首页', icon: '' },
    component: () => import('../views/home/index.vue'),
  },
  {
    name: 'product',
    path: '/product',
    meta: { title: '产品功能', icon: '' },
    redirect: '/product/eia',
    children: [
      {
        name: 'productEia',
        path: '/product/eia',
        component: () => import('../views/product/eia/index.vue'),
        meta: { title: '·B2B市场洞察平台', icon: '' },
      },
      {
        name: 'ProductInterface',
        path: '/product/interface',
        component: () => import('../views/product/interface/index.vue'),
        meta: { title: '·数据API', icon: '' },
      },
    ],
    //
  },
  {
    name: 'solution',
    path: '/solution',
    meta: { title: '解决方案', icon: '' },
    redirect: '/solution/industry',
    // component: () => import('../views/solution/index.vue')
    children: [
      {
        name: 'SolutionIndustry',
        path: '/solution/industry',
        component: () => import('../views/solution/industry/index.vue'),
        meta: { title: '面向行业市场', icon: '' },
      },
      {
        name: 'SolutionBusiness',
        path: '/solution/business',
        component: () => import('../views/solution/business/index.vue'),
        meta: { title: '面向商业市场', icon: '' },
      },
      {
        name: 'SolutionDistribution',
        path: '/solution/distribution',
        component: () => import('../views/solution/distribution/index.vue'),
        meta: { title: '面向分销市场', icon: '' },
      },
      {
        name: 'SolutionOverseas',
        path: '/solution/overseas',
        component: () => import('../views/solution/overseas/index.vue'),
        meta: { title: '面向海外市场', icon: '' },
      },
      {
        name: 'SolutionInvestmentAttraction',
        path: '/solution/investmentAttraction',
        component: () => import('../views/solution/investmentAttraction/index.vue'),
        meta: { title: '产业招商方案', icon: '' },
      },
    ],
  },
  {
    name: 'case',
    path: '/case',
    meta: { title: '客户案例', icon: '' },
    component: () => import('../views/case/index.vue'),
  },
  {
    name: 'about',
    path: '/about',
    meta: { title: '关于我们', icon: '' },
    component: () => import('../views/about/index.vue'),
  },
  {
    name: 'becomingPartners',
    path: '/becomingPartners',
    meta: { title: '成为伙伴', icon: '' },
    component: () => import('../views/becomingPartners/index.vue'),
  },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  scrollBehavior: () => ({ left: 0, top: 0 }),
  routes: [
    ...baseRouter,
    {
      name: '404',
      path: '/404',
      component: () => import(/* webpackChunkName: "fail" */ '../views/error/404.vue'),
    },
    {
      name: 'NotFound',
      path: '/:pathMatch(.*)*',
      redirect: '/404',
    },
  ],
})

export { baseRouter }
export default router
